//
//  AreaViewController.m
//  计算机
//
//  Created by student on 16/2/22.
//  Copyright © 2016年 niit. All rights reserved.
//

#import "AreaViewController.h"

extern int count;
@interface AreaViewController ()
@property (weak, nonatomic) IBOutlet UITextField *LengthTextFile;
@property (weak, nonatomic) IBOutlet UITextField *WidthTextFile;
@property (weak, nonatomic) IBOutlet UITextField *RectAreaTextFile;
@property (weak, nonatomic) IBOutlet UITextField *RadiusTextField;
@property (weak, nonatomic) IBOutlet UITextField *CircleAreaTextField;


@end

@implementation AreaViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

- (IBAction)calBtnPressed:(id)sender
{
    float length = [self.LengthTextFile.text intValue];
    float width = [self.WidthTextFile.text intValue];
    float area1 = length * width;
    self.RectAreaTextFile.text = [NSString stringWithFormat:@"%g",area1];
    
    float radius = [self.RadiusTextField.text intValue];
    float area2 = M_PI * radius *radius;
    self.CircleAreaTextField.text = [NSString stringWithFormat:@"%g",area2];
    count++;
}
- (IBAction)backTap:(id)sender
{
    [self.view endEditing:YES];
}
@end
